class Chapter < ActiveRecord::Base
	belongs_to :novel
	has_many :fragments
	has_one :merge
	
	#This should be cached
	def merged_fragment
		merge = Merge.where(["chapter_id=?", self.id])
		if merge.size == 1
			Fragment.find merge[0].fragment_id
		else
			nil
		end
	end
end
